package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PowerTreasureMapper;
import com.ruoyi.system.domain.PowerTreasure;
import com.ruoyi.system.service.IPowerTreasureService;

/**
 * 充电宝Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-21
 */
@Service
public class PowerTreasureServiceImpl implements IPowerTreasureService 
{
    @Autowired
    private PowerTreasureMapper powerTreasureMapper;

    /**
     * 查询充电宝
     * 
     * @param treasureId 充电宝主键
     * @return 充电宝
     */
    @Override
    public PowerTreasure selectPowerTreasureByTreasureId(Long treasureId)
    {
        return powerTreasureMapper.selectPowerTreasureByTreasureId(treasureId);
    }

    /**
     * 查询充电宝列表
     * 
     * @param powerTreasure 充电宝
     * @return 充电宝
     */
    @Override
    public List<PowerTreasure> selectPowerTreasureList(PowerTreasure powerTreasure)
    {
        return powerTreasureMapper.selectPowerTreasureList(powerTreasure);
    }

    /**
     * 新增充电宝
     * 
     * @param powerTreasure 充电宝
     * @return 结果
     */
    @Override
    public int insertPowerTreasure(PowerTreasure powerTreasure)
    {
        powerTreasure.setCreateTime(DateUtils.getNowDate());
        return powerTreasureMapper.insertPowerTreasure(powerTreasure);
    }

    /**
     * 修改充电宝
     * 
     * @param powerTreasure 充电宝
     * @return 结果
     */
    @Override
    public int updatePowerTreasure(PowerTreasure powerTreasure)
    {
        powerTreasure.setUpdateTime(DateUtils.getNowDate());
        return powerTreasureMapper.updatePowerTreasure(powerTreasure);
    }

    /**
     * 批量删除充电宝
     * 
     * @param treasureIds 需要删除的充电宝主键
     * @return 结果
     */
    @Override
    public int deletePowerTreasureByTreasureIds(Long[] treasureIds)
    {
        return powerTreasureMapper.deletePowerTreasureByTreasureIds(treasureIds);
    }

    /**
     * 删除充电宝信息
     * 
     * @param treasureId 充电宝主键
     * @return 结果
     */
    @Override
    public int deletePowerTreasureByTreasureId(Long treasureId)
    {
        return powerTreasureMapper.deletePowerTreasureByTreasureId(treasureId);
    }
}
